﻿/**
 * 
 * @file   FITKVAOneHDF5AbstractAdaptor.h
 * @brief  VAOne HDF5 读写器抽象类
 * @author TanDongYang (tandongyang@diso.cn)
 * @date   2024-11-25
 * 
 */
#ifndef FITKVAONEHDF5ABSTRACTADAPTOR_H
#define FITKVAONEHDF5ABSTRACTADAPTOR_H

#include "FITKVAOneHDF5IOAPI.h"
#include "FITK_Kernel/FITKAdaptor/FITKAbstractIOAdaptor.h"
#include "FITKVAOneHDF5Base.h"

namespace H5
{
    class H5File;
}

namespace Acoustics 
{
    class FITKAcousticsHDF5DataSet;
}

namespace IO
{
    /**
     * @brief   VAOne HDF5 读写器抽象类
     * @author  TanDongYang (tandongyang@diso.cn)
     * @date    2024-11-25 
     */
    class FITKVAOneHDF5IO_API FITKVAOneHDF5AbstractAdaptor : public Adaptor::FITKAbstractIOAdaptor
        ,public VAOne::FITKVAOneHDF5Base
    {
    public:

        /**
         * @brief   Construct a new FITKVAOneHDF5AbstractAdaptor object
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        explicit FITKVAOneHDF5AbstractAdaptor() = default;

        /**
         * @brief   Destroy the FITKVAOneHDF5AbstractAdaptor object
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        virtual ~FITKVAOneHDF5AbstractAdaptor() = default;

        /**
         * @brief   设置H5File对象指针
         * @param[i]   val  对象指针
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        void setH5file(H5::H5File* val) { _h5file = val; }

        /**
         * @brief   设置组的名称
         * @param[i]   val  名称
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        void setGroupName(std::string val) { _groupName = val; }

    protected:

        /**
         * @brief   读取组名称数据
         * @return  读取成功状态
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-25 
         */
        virtual bool readGroupName();

        /**
         * @brief       读取数据集数据
         * @param[i]   dataSetName  数据集名称
         * @return      读取成功状态
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-25 
         */
        virtual bool readDataSet(std::string dataSetName);

        /**
         * @brief       读取数据集组数据
         * @return      读取成功状态
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-25 
         */
        virtual bool readDataSetGroup();

        /**
         * @brief       读取参数数据
         * @param[i]   groupName 组名称
         * @param[i]   attrName 参数名称
         * @return      读取成功状态
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-25 
         */
        virtual bool readAttribute(std::string attrName);
        virtual bool readAttribute(std::string groupName,std::string attrName);

        /**
         * @brief   读取参数数据组
         * @return  读取成功状态
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-25 
         */
        virtual bool readAttributeGroup();

        /**
         * @brief   H5File的对象指针
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        H5::H5File* _h5file{};

        /**
         * @brief   组的名称
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        std::string _groupName{};

    };

}

#endif // FITKVAONEHDF5ABSTRACTADAPTOR_H
